function energy=Energy2(T)
	global TD;
	energy=0;

    if(T < TD)
		energy=4;
	else if(T > TD+1)
		energy=1;
    end
    end
end